package cn.yunyichina.provider.base.dao;

import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import cn.yunyichina.provider.base.entity.MedicalCard;
import cn.yunyichina.provider.framework.annotation.MyBatisRepository;
import cn.yunyichina.provider.framework.mvc.dao.BaseDao;

import java.util.List;

/**
*
* @Author auto_gen_by_tool
* @CreatedTime 2016-08-13 10:06:04
*/
@Repository
@MyBatisRepository
public interface MedicalCardDao extends BaseDao<cn.yunyichina.provider.base.entity.MedicalCard>{

	
	/**
	 * 根据cardNo查找诊疗卡
	 * @param cardNo 诊疗卡号
	 * @param
	 * @param orgCode
	 *
	 * @return
	 */
	public MedicalCard getMedicalCardByCardNo(@Param("orgCode") String orgCode,@Param("medicalCardNo") String medicalCardNo,@Param("medicalCardType") short medicalCardType);
	public List<MedicalCard> selectByUserIdsAndBindSource(@Param("userIdList") List<String> userIdList, @Param("bindSource")Integer bindSource, @Param("hospitalCode")String hospitalCode );
	void updateMedicalCardStateById(@Param("medicalCardId") String medicalCardId);
	MedicalCard selectUniqueMedicalCard(@Param("orgCode") String orgCode,@Param("medicalCardNo") String medicalCardNo,@Param("medicalCardType") short medicalCardType, @Param("userId") String userId,@Param("familyId") String familyId);
	List<MedicalCard> selectSelfAllCard(@Param("userId") String userId ,@Param("familyId")String familyId);
	List<MedicalCard> selectByUserId(@Param("hospitalCode") String hospitalCode,@Param("userId") String userId,@Param("familyId") String familyId);
	MedicalCard selectByCardNoAndUserIdAndFamilyId(@Param("hospitalCode") String hospitalCode,@Param("cardNo") String cardNo ,@Param("userId") String userId ,@Param("familyId")String familyId);
	MedicalCard selectByCardNoAndUserId(@Param("hospitalCode") String hospitalCode,@Param("cardNo") String cardNo ,@Param("userId") String userId );
	void deleteMedicalCardByFamilyId(@Param("familyId")String familyId);
	List<MedicalCard> selectCardByOpenIdAndCard(@Param("hospitalCode") String hospitalCode,@Param("medicalCardNo") String medicalCardNo,@Param("userId") String userId);
	void updatePatientInfoByPatId(MedicalCard MedicalCard);
	List<MedicalCard> selectMedicalcardByCardnoAndAppid(@Param("cardNo") String cardNo ,@Param("appId")String appId);
    void updateInsuranceType(MedicalCard medicalCard);
	void updateByPatCardNo(MedicalCard medicalCard);

}